<?php
abstract class Model
{
	public function __construct()
	{
		
	}
	
	public function initDb()
	{
		
	}
	
	public function fetchAll()
	{
		
	}
	
	public function fetchRow()
	{
		
	}
	
	public function fetchOne()
	{
		
	}
	
	public function fetchPage()
	{
		
	}
	
	public function query()
	{
		
	}
	
	public function insert()
	{
		
	}
	
	public function edit()
	{
		
	}
	
	public function delete()
	{
		
	}
	
	public function getInsertId()
	{
		return $this->last_insert_id;
	}
	
	/**
	 * 记录日志
	 *
	 * @param string $content
	 */
	public function log($content)
	{
		$content = date('Y-m-d H:i:s') . " " . $this->dsn . " : " . $content . "\n";
		$log_file_path = TEMP_DIR .DS. 'logs' .DS. 'model.log';
		$handle = fopen($log_file_path, 'at');
		fwrite($handle, $content);
		fclose($handle);
	}
}
?>